home *** CD-ROM | disk | FTP | other *** search
- /
- / Copyright (C) 1993 Michael Davidson.
- / All rights reserved.
- /
- / Permission to use, copy, modify, and distribute this software
- / and its documentation for any purpose and without fee is hereby
- / granted, provided that the above copyright notice appear in all
- / copies and that both that copyright notice and this permission
- / notice appear in supporting documentation.
- /
- / This software is provided "as is" without express or implied warranty.
- /
- .text
- /
- / ycc_to_rgb(
- / unsigned char *y_ptr,
- / unsigned char *cb_ptr,
- / unsigned char *cr_ptr,
- / int count
- / )
- /
- .globl ycc_to_rgb
-
- Y_PTR = 8
- CB_PTR = 12
- CR_PTR = 16
- RGB_PTR = 20
- COUNT = 24
-
- ycc_to_rgb:
- pushl %ebp
- movl %esp,%ebp
- pushl %esi
- pushl %edi
- pushl %ebx
-
- movl Y_PTR(%ebp), %esi
- movl CB_PTR(%ebp), %edi
- movl CR_PTR(%ebp), %ebx
- movl COUNT(%ebp), %ecx
- movl RGB_PTR(%ebp),%ebp
- pushl %ecx
- jmp L2
- nop
-
- .align 4
- L1:
- xorl %ecx, %ecx
- xorl %eax, %eax
- movb (%esi), %cl / ecx = Y
- movb (%ebx), %al / eax = CR
- leal range_tab+0x100(%ecx), %ecx / ecx = &range_limit[y]
- movl %eax, %edx / save CR
- /
- / rgb[0] = range_limit[y + Cr_r_tab[cr]]; /* red */
- /
- movl Cr_r_tab(,%eax,4), %eax
- movb (%ecx,%eax,1), %al
- movb %al, 0(%ebp)
- /
- / rgb[2] = range_limit[y + Cb_b_tab[cb]]; /* blue */
- /
- xorl %eax, %eax
- movb (%edi), %al / eax = CB
- movb %al, %dh / save CB
- movl Cb_b_tab(,%eax,4), %eax
- movb (%ecx,%eax,1), %al
- movb %al, 0x2(%ebp)
- /
- / rgb[1] = range_limit[y + ((Cb_g_tab[cb]+Cr_g_tab[cr]) >> SCALEBITS)];
- /
- xorl %eax, %eax
- movb %dh, %al / eax = CB
- xorb %dh, %dh / edx = CR
- movl Cb_g_tab(,%eax,4), %eax
- addl Cr_g_tab(,%edx,4), %eax
- sarl $16, %eax
- movb (%ecx,%eax,1), %al
- movb %al, 1(%ebp)
-
- incl %esi
- incl %edi
- incl %ebx
- leal 3(%ebp),%ebp
- L2:
- decl (%esp)
- jge L1
-
- popl %ecx / clean the stack
-
- popl %ebx
- popl %edi
- popl %esi
- popl %ebp
- ret
-